﻿<Application x:Class="XmlEditor.Presentation.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/ImageResources.xaml"/>
                <ResourceDictionary Source="Resources/ControlResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="MenuItem">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}"
                                 Value="False">
                        <Setter Property="Opacity"
                                Value="0.6" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="{x:Static ToolBar.ButtonStyleKey}"
                   TargetType="{x:Type Button}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}"
                                 Value="False">
                        <Setter Property="Opacity"
                                Value="0.35" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style TargetType="{x:Type Image}"
                   x:Key="toolbarImageStyle">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}, AncestorLevel=1}, Path=IsEnabled}"
                                 Value="False">
                        <Setter Property="Opacity"
                                Value="0.50"></Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style TargetType="{x:Type Image}"
                   x:Key="menuItemImageStyle">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuItem}, AncestorLevel=1}, Path=IsEnabled}"
                                 Value="False">
                        <Setter Property="Opacity"
                                Value="0.50"></Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>
